<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<BreukTrainerOnline.Models.Opdracht>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewOpdrachten
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>View Opdrachten</h2>
    
    <%= Html.ValidationSummary("Errors:")%>

    <table>
        <tr>
            <th>
                <%= Html.ActionLink("Details", "ViewOpdrachtDetails") %>
            </th>
            <th>
                OpdrachtID
            </th>
            <th>
                Datum
            </th>
            <th>
                Moeilijkheidsgraad
            </th>
            <th>
                MaxScore
            </th>
            <th>
                Status
            </th>
            <th>
                Tijdslimiet
            </th>
            <th></th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
                <%= Html.ActionLink("Details", "ViewOpdrachtDetails", new { id = item.OpdrachtID })%>
            </td>
            <td>
                <%= Html.Encode(item.OpdrachtID) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.Datum)) %>
            </td>
            <td>
                <%= Html.Encode(item.Moeilijkheidsgraad) %>
            </td>
            <td>
                <%= Html.Encode(item.MaxScore) %>
            </td>
            <td>
                <img src="<%= item.Status == true ? Url.Content("~/Images/Correct.png") : Url.Content("~/Images/delete.png")%>" alt="[status]" /> 
            </td>
            <td>
                <%= item.Tijdslimiet == null ? Html.Encode("Geen") : Html.Encode(item.Tijdslimiet) %>
            </td>
            <td>
                <% Html.RenderPartial("OpdrachtActionUserControl", item); %>                
            </td>
        </tr>
    
    <% } %>

    </table>

    <p>
        <% if (Request.IsAuthenticated)
           {
               if (Page.User.IsInRole("Admin"))
               {
        %>
                    <%= Html.ActionLink("Nieuwe Opdracht", "NieuweOpdracht")%>
        <%
               }
           }
        %>
    </p>

</asp:Content>

